<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:replace="~{fragments/layout :: layout(~{::title}, ~{::section})}">

<head>
    <title>首页 - 图书馆管理系统</title>
</head>

<body>
    <section>
        <div class="jumbotron">
            <h1 class="display-4">欢迎使用图书馆管理系统</h1>
            <p class="lead">这是一个功能完善的图书馆管理系统，可以方便地管理图书、用户、借阅和评论信息。</p>
            <hr class="my-4">
            <p>点击下方按钮开始使用系统功能。</p>
            <a class="btn btn-primary btn-lg" href="/book/list" role="button">浏览图书</a>
        </div>

        <div class="row">
            <div class="col-md-6">
                <div class="card mb-4">
                    <div class="card-header">
                        <h5 class="card-title mb-0">最新图书</h5>
                    </div>
                    <div class="card-body">
                        <div class="list-group">
                            <div th:each="book : ${books}" class="list-group-item list-group-item-action">
                                <div class="d-flex w-100 justify-content-between">
                                    <h5 class="mb-1" th:text="${book.name}">图书名称</h5>
                                    <small th:text="${book.categoryName}">分类名称</small>
                                </div>
                                <p class="mb-1" th:text="${book.author}">作者</p>
                                <small>库存: <span th:text="${book.stock}">10</span> 本</small>
                                <a th:href="@{/book/detail/{id}(id=${book.id})}"
                                    class="btn btn-sm btn-outline-primary float-right">查看详情</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="card mb-4">
                    <div class="card-header">
                        <h5 class="card-title mb-0">图书分类</h5>
                    </div>
                    <div class="card-body">
                        <div class="list-group">
                            <a th:each="category : ${categories}" th:href="@{/book/list(categoryId=${category.id})}"
                                class="list-group-item list-group-item-action">
                                <div class="d-flex w-100 justify-content-between">
                                    <h5 class="mb-1" th:text="${category.name}">分类名称</h5>
                                </div>
                                <p class="mb-1" th:text="${category.description}">分类描述</p>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="row mt-4">
            <div class="col-md-4">
                <div class="card text-white bg-primary mb-3">
                    <div class="card-header">图书管理</div>
                    <div class="card-body">
                        <h5 class="card-title">管理图书信息</h5>
                        <p class="card-text">添加、编辑、删除图书，管理图书库存。</p>
                        <a href="/book/list" class="btn btn-light">进入管理</a>
                    </div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="card text-white bg-success mb-3">
                    <div class="card-header">借阅管理</div>
                    <div class="card-body">
                        <h5 class="card-title">管理借阅记录</h5>
                        <p class="card-text">借书、还书、查看借阅历史。</p>
                        <a href="/borrow/list" class="btn btn-light">进入管理</a>
                    </div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="card text-white bg-info mb-3">
                    <div class="card-header">用户管理</div>
                    <div class="card-body">
                        <h5 class="card-title">管理用户信息</h5>
                        <p class="card-text">添加、编辑、删除用户，查看用户借阅记录。</p>
                        <a href="/user/list" class="btn btn-light">进入管理</a>
                    </div>
                </div>
            </div>
        </div>
    </section>
</body>

</html>